home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / grafica / pvrgjpeg / system.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  4KB  |  100 lines

  1. /*************************************************************
  2. Copyright (C) 1990, 1991, 1993 Andy C. Hung, all rights reserved.
  3. PUBLIC DOMAIN LICENSE: Stanford University Portable Video Research
  4. Group. If you use this software, you agree to the following: This
  5. program package is purely experimental, and is licensed "as is".
  6. Permission is granted to use, modify, and distribute this program
  7. without charge for any purpose, provided this license/ disclaimer
  8. notice appears in the copies.  No warranty or maintenance is given,
  9. either expressed or implied.  In no event shall the author(s) be
  10. liable to you or a third party for any special, incidental,
  11. consequential, or other damages, arising out of the use or inability
  12. to use the program for any purpose (or the loss of data), even if we
  13. have been advised of such possibilities.  Any public reference or
  14. advertisement of this source code should refer to it as the Portable
  15. Video Research Group (PVRG) code, and not by any author(s) (or
  16. Stanford University) name.
  17. *************************************************************/
  18. /*
  19. ************************************************************
  20. system.h
  21.  
  22. This file contains the miscellaneous definitions for running
  23. the JPEG coder.
  24.  
  25. ************************************************************
  26. */
  27.  
  28. #ifndef SYSTEM_DONE
  29. #define SYSTEM_DONE
  30. #include <sys/file.h>
  31.  
  32. #define IOB_BLOCK 0
  33. #define IOB_LINE 1
  34. #define IOB_OVERSAMPLEBLOCK 2
  35.  
  36. #define BUFFER struct io_buffer
  37. #define IOBUF struct io_buffer_list
  38.  
  39. #define XHUFF struct huffman_standard_structure
  40. #define EHUFF struct huffman_encoder
  41. #define DHUFF struct huffman_decoder
  42.  
  43. BUFFER {
  44. unsigned int overflow;   /* The last buffer character on line overflow */
  45. int data_linelast;       /* The last element read out for line buffering */
  46. int disable;             /* Stream is disabled! */
  47. int wsize;               /* Element word size in characters */
  48. int size;                /* Size of buffer in characters */
  49. long currentoffs;        /* Current offset from left edge of image */
  50. long streamoffs;         /* Stream offset (the pixel index of left edge) */
  51. unsigned char *space;    /* Space is the raw buffer pointer */
  52. unsigned char *bptr;     /* Current base pointer of buffer */
  53. unsigned char *tptr;     /* Current top pointer of buffer */
  54. IOBUF *iob;              /* References own IOB */
  55. };
  56.  
  57.  
  58. IOBUF {
  59. int type;                     /* Iob type */
  60. int num;                      /* Number of buffers */
  61. int wsize;                    /* Element word size in characters */
  62. int hpos;                     /* Current block position in image */
  63. int vpos;
  64. int hor;                      /* Sampling frequency */
  65. int ver;
  66. int width;                    /* Width and height of image */
  67. int height; 
  68. int file;                     /* File descriptor */
  69. int flags;                    /* File mode flags */
  70. int linelastdefault;          /* Last line element default */
  71. BUFFER **blist;               /* A list of buffers */
  72. };
  73.  
  74. /* XHUFF contains all the information that needs be transmitted */
  75. /* EHUFF and DHUFF are derivable from XHUFF */
  76.  
  77. XHUFF {
  78. int bits[36];          /* Bit-length frequency (indexed on length  */
  79. int huffval[257];      /* Huffman value index */
  80. };
  81.  
  82. /* Encoder tables */
  83.  
  84. EHUFF {
  85. int ehufco[257];      /* Encoder huffman code indexed on code word */
  86. int ehufsi[257];      /* Encoder huffman code-size indexed on code word */
  87. };
  88.  
  89. /* Decoder tables */
  90.  
  91. DHUFF {
  92. int ml;               /* Maximum length */
  93. int maxcode[36];      /* Max code for a given bit length -1 if no codes */
  94. int mincode[36];      /* Min code for a given bit length */
  95. int valptr[36];       /* First index (of min-code) for a given bit-length */
  96. };
  97.  
  98.  
  99. #endif
  100.